﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject
{
    public class GCGBWHOutputMaster : NotifyPropertyChangeObject
    {

        private int gcgbWHOutputID;

        private string gcgbWHOutputReference;

        private int gcgbCommandID;
        private string gcgbCommandReference;
        private DateTime gcgbCommandDate;


        private int stockMaterialID;

        private int preparedEmployeeID;
        private int approvedEmployeeID;

        private DateTime gcgbWHOutputDate;
        private DateTime entryDate;

        private string remarks;

        

        public GCGBWHOutputMaster()
        {
            GlobalDefaultValue.Apply(this);

            this.GCGBWHOutputDate = DateTime.Today;
            this.EntryDate = DateTime.Today;
        }

        public GCGBWHOutputMaster ShallowClone()
        {
            return (GCGBWHOutputMaster)this.MemberwiseClone();
        }

        #region Properties


        //[DefaultValue(-1)]
        public int GCGBWHOutputID
        {
            get { return this.gcgbWHOutputID; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, int>(ref this.gcgbWHOutputID, o => o.GCGBWHOutputID, value); }
        }


        [DefaultValue("")]
        public string GCGBWHOutputReference
        {
            get { return this.gcgbWHOutputReference; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, string>(ref this.gcgbWHOutputReference, o => o.GCGBWHOutputReference, value); }
        }


        [DefaultValue("")]
        public string Remarks
        {
            get { return this.remarks; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, string>(ref this.remarks, o => o.Remarks, value); }
        }

                

        [DefaultValue(0)]
        public int GCGBCommandID
        {
            get { return this.gcgbCommandID; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, int>(ref this.gcgbCommandID, o => o.GCGBCommandID, value); }
        }

        [DefaultValue("")]
        public string GCGBCommandReference
        {
            get { return this.gcgbCommandReference; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, string>(ref this.gcgbCommandReference, o => o.GCGBCommandReference, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime GCGBCommandDate
        {
            get { return this.gcgbCommandDate; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, DateTime>(ref this.gcgbCommandDate, o => o.GCGBCommandDate, value); }
        }

        public string GCGBCommandReferenceAndDate
        {
            get { return this.GCGBCommandReference + " [" + this.GCGBCommandDate.ToShortDateString() + "]"; }
        }


        [DefaultValue(0)]
        public int StockMaterialID
        {
            get { return this.stockMaterialID; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, int>(ref this.stockMaterialID, o => o.StockMaterialID, value); }
        }
        

        [DefaultValue(0)]
        public int PreparedEmployeeID
        {
            get { return this.preparedEmployeeID; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, int>(ref this.preparedEmployeeID, o => o.PreparedEmployeeID, value); }
        }


        [DefaultValue(0)]
        public int ApprovedEmployeeID
        {
            get { return this.approvedEmployeeID; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, int>(ref this.approvedEmployeeID, o => o.ApprovedEmployeeID, value); }
        }


        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime GCGBWHOutputDate
        {
            get { return this.gcgbWHOutputDate; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, DateTime>(ref this.gcgbWHOutputDate, o => o.GCGBCommandDate, value); }
        }

        [DefaultValue(typeof(DateTime), "01/01/1900")]
        public DateTime EntryDate
        {
            get { return this.entryDate; }
            set { ApplyPropertyChange<GCGBWHOutputMaster, DateTime>(ref this.entryDate, o => o.EntryDate, value); }
        }

        
        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("GCGBCommandID", "Please select a command.", delegate { return this.GCGBCommandID > 0; }));
            validationRules.Add(new SimpleValidationRule("GCGBCommandReferenceAndDate", "Please select a command.", delegate { return this.GCGBCommandID > 0; }));
            validationRules.Add(new SimpleValidationRule("GCGBWHOutputReference", "Reference cannot be blank.", delegate { return this.GCGBWHOutputReference.Length != 0; }));
            validationRules.Add(new SimpleValidationRule("StockMaterialID", "Stock cannot be empty.", delegate { return this.StockMaterialID != 0; }));
            validationRules.Add(new SimpleValidationRule("PreparedEmployeeID", "Prepared Person cannot be empty.", delegate { return this.PreparedEmployeeID != 0; }));
            validationRules.Add(new SimpleValidationRule("ApprovedEmployeeID", "Approved Person Name cannot be empty.", delegate { return this.ApprovedEmployeeID != 0; }));

            return validationRules;
        }

    }
}
